package com.idna.wsconsumer.xfire.dynamic;

public class DynamicClientTestImpl extends DynamicClientTest
{
	private XFireDynamicClientImpl netIdClient = null;
	private XFireDynamicClientImpl proveIdClient = null;
	private Object[] resp = null;

	protected void setUp()
	{
		super.setContext();
		loadBean();
	}

	public void loadBean()
	{
		netIdClient = (XFireDynamicClientImpl) super.getContext().getBean("xfireDynamicNetIdClient");
		proveIdClient = (XFireDynamicClientImpl) super.getContext().getBean("xfireDynamicProveIdClient");
	}

	public void testInvoke()
	{
		try
		{
			// Test client taking an array of objects as request inputs
			WATCH.start("netIdTest:");
			resp = netIdClient.invoke();
			WATCH.stop();
			//LOGGER.info(WATCH.prettyPrint());
			assertNotNull(resp);
			assertTrue(resp.length > 0);

			for (Object res : resp)
			{
				LOGGER.info(res);
			}

			resp = null;
			WATCH.start("proveIdTest");
			resp = proveIdClient.invoke();
			WATCH.stop();
			LOGGER.info(WATCH.prettyPrint());
			
			assertNotNull(resp);
			assertTrue(resp.length > 0);

			for (Object res : resp)
			{
				LOGGER.info(res);
			}
		}
		catch (Exception e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
